<?php
/*
Bitsand - a web-based booking system for LRP events
Copyright (C) 2006, 2007 Russell Peter Phillips

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
*/

include ('../inc/inc_head_db.php');
include ('../inc/inc_admin.php');
include ('../inc/inc_head_html.php');

//Report on number of spell cards & lore sheets required for booked characters

//Get list of players
$db_prefix = DB_PREFIX;
$sql = "SELECT bkPlayerID, bkDatePaymentConfirmed, stPlayerID, stSkillID " .
	"FROM {$db_prefix}skillstaken, {$db_prefix}bookings " .
	"WHERE stPlayerID = bkPlayerID AND bkDatePaymentConfirmed <> '0000-00-00' AND bkDatePaymentConfirmed <> ''";
$result = ba_db_query ($link, $sql);

//Initialise counters
$iCards = 0;
$iSenseMagic = 0;
$iEvaluate = 0;
$iPotionLore = 0;
$iPoisonLore = 0;
$iRecForgery = 0;

while ($row = ba_db_fetch_assoc ($result)) {
	// Level 1 magics
	if ($row ['stSkillID'] == 21 || $row ['stSkillID'] == 25 || $row ['stSkillID'] == 29)
		$iCards = $iCards + 4;
	// Level 2 magics
	if ($row ['stSkillID'] == 23 || $row ['stSkillID'] == 27 || $row ['stSkillID'] == 31)
		$iCards = $iCards + 12;
	// Power skills. Same effect as level 1 magics, but seperating it out makes it easier to read ;-)
	if ($row ['stSkillID'] == 10 || $row ['stSkillID'] == 12 || $row ['stSkillID'] == 14 || $row ['stSkillID'] == 16)
		$iCards = $iCards + 4;
	if ($row ['stSkillID'] == 24)
		$iSenseMagic++;
	if ($row ['stSkillID'] == 26)
		$iEvaluate++;
	if ($row ['stSkillID'] == 18)
		$iPotionLore++;
	if ($row ['stSkillID'] == 20)
		$iPoisonLore++;
	if ($row ['stSkillID'] == 28)
		$iRecForgery++;
}

//Get number of meal tickets
$sql = "SELECT COUNT(*) AS cMealTickets FROM {$db_prefix}bookings " .
	"WHERE bkDatePaymentConfirmed <> '0000-00-00' AND bkDatePaymentConfirmed <> '' AND bkMealTicket = 1";
$result = ba_db_query ($link, $sql);
$row = ba_db_fetch_assoc ($result);
$iMeal = (int) $row ['cMealTickets'];
?>

<h1><?php echo TITLE?> - Cards &amp; Lore Sheets</h1>

<p>
<a href = 'admin.php'>Admin</a>
</p>

<p>
Number of cards, lore sheets &amp; meal tickets needed for the pre-booked characters:
</p>

<h3>Power Cards</h3>

<p>
<?php echo $iCards?> Power cards per day
</p>

<h3>Lore Sheets</h3>

<p>
<?php echo $iSenseMagic?> Sense Magic lore sheets<br>
<?php echo $iEvaluate?> Evaluate lore sheets<br>
<?php echo $iPotionLore?> Potion Lore lore sheets<br>
<?php echo $iPoisonLore?> Poison Lore lore sheets<br>
<?php echo $iRecForgery?> Recognise Forgery lore sheets<br>
</p>

<h3>Meal Tickets</h3>

<p>
<?php echo $iMeal?> meal tickets<br>
</p>

<p>
<b>Notes:</b><br>
Lore sheets for OSP skills are not listed.<br>
This is only for those people booked on this system. If you are expecting bookings on the gate, you may need more. Also, if characters die, you may need more cards and/or lore sheets for the new characters.
</p>

<?php
include ('../inc/inc_foot.php');
?>
